package com.eh.iteratorAndComposition.modle;

import com.eh.iteratorAndComposition.base.AbstractMenu;
import com.eh.iteratorAndComposition.base.MenuComponent;
import com.google.common.collect.Lists;

import java.util.Iterator;
import java.util.List;

/**
 * Created by David on 2016/5/1.
 */
public class PancakeHouseMenu extends AbstractMenu {
    List<MenuComponent> menus;

    public PancakeHouseMenu() {
        menus = Lists.newArrayList();
        name = "早餐煎饼菜单";
        description = "快捷营养， 是我们的目标";
        add(new MenuItem("草莓煎饼", "香浓草莓， 柔润丝滑", 15.8, true));
        add(new MenuItem("鸡蛋煎饼", "农家炒鸡蛋， 吃出家的味道", 12.5, false));
    }

    @Override
    public void add(MenuComponent menuComponent) {
        menus.add(menuComponent);
    }

    @Override
    public void remove(MenuComponent menuComponent) {
        menus.remove(menuComponent);
    }

    @Override
    public MenuComponent get(int i) {
        return menus.get(i);
    }

    @Override
    public Iterator<MenuComponent> createIterator() {
        return menus.iterator();
    }
}
